/*!
 * =====================================================
 * 无忧车贷整体js
 * =====================================================
 */
mui.init();
/*选项卡跳转*/
mui('body').on('tap','a',function(){document.location.href=this.href;});
/*首页轮播*/
function noticeUp(obj,top,time) {
	$(obj).animate({
			marginTop: top
	}, time, function () {
		$(this).css({marginTop:"0"}).find(":first").appendTo(this);
	 	}
	);
	setTimeout("noticeUp('.lunbo ul','-2rem',500)", 2000);
}

$(function () {
	// 调用 公告滚动函数
	var lunbo_ul_index = document.getElementsByClassName("lunbo");
	if(lunbo_ul_index){
		setTimeout("noticeUp('.lunbo ul','-2rem',500)", 2000);
		//console.log(1)
	}else{}

});

/*侧滑导航*/

	 //侧滑容器父节点
	var offCanvasWrapper = mui('#offCanvasWrapper');
	if(offCanvasWrapper){
		//主界面容器
		// var offCanvasInner = offCanvasWrapper[0].querySelector('.mui-inner-wrap');
		//  //菜单容器
		// var offCanvasSide = document.getElementById("offCanvasSide");
		//  //侧滑容器的class列表，增加.mui-slide-in即可实现菜单移动、主界面不动的效果；
		// var classList = offCanvasWrapper[0].classList;
        //
		// offCanvasWrapper[0].insertBefore(offCanvasSide, offCanvasWrapper[0].firstElementChild);
		// classList.add('mui-scalable');
		// document.getElementById('offCanvasHide').addEventListener('tap', function() {
		// 	offCanvasWrapper.offCanvas('close');
		// });
		 //主界面和侧滑菜单界面均支持区域滚动；
		// mui('#offCanvasSideScroll').scroll();
		// mui('#offCanvasContentScroll').scroll();
		 //实现ios平台的侧滑关闭页面；

	}else{}



/*提现页弹出框*/
$("#alertBtm").click(function(){
	function showSingle(content){
		var containHtml;
	    containHtml = '<div id="tipView">  <span class="mui-icon iconfont icon-duihao2"></span> <div id="tv_sureBtn">提交成功</div> </div>';
	    $(document).find("body").append(containHtml);
	    setTimeout(function(){
		  $("#tipView").animate({
	  		opacity: "hide"
	       }, "slow");
		},1000);
		setTimeout(function(){
			$("#tipView").remove()
		},1500);
	}
	showSingle();
});


/*初级牛人提交申请按钮*/
function cjnr_fade_wh(){
	var minMoney = 10000;
    var maxMoney = 5000000;
	if(!$('#cjnr_checkbox_id').is(':checked')) {
        layer.msg("请先阅读并同意签署", {icon: 6});
        return;
    }

    var a = Math.round($("#celuezijin_zhi").val());
    if(a<minMoney || a>maxMoney){
        layer.msg("请输入投资资本，最少1万，最多500万", {icon: 6});
        return;
    }
    if(a%1000>0){
        layer.msg("实盘资金必须是1000的整数倍!", {icon: 6});
        return;
    }

    var withfundingMoney=$("#celuezijin_zhi").val();  // 输入的投资本金
    var money1 = $("#cjnr_baozj").text(); // 风险保障金
    var money2 = $("#cjnr_allmoney").text(); // 总操盘资金
    var money3 = $("#cjnr_warningLine").text(); // 亏损警戒线
    var money4 = $("#cjnr_openLine").text(); // 亏损平仓线
    var money5 = $("#cjnr_zhanglf").text(); // 账户管理费
    var isTomorrowGetMoney=1; // 开始交易时间,默认1
    var getlever = $("input[name='cjnr2_checkbox2']:checked").val(); //放大倍数
    var cycle=$("#cjnr_select1").val();  // 几个月
    var productId=8;
    var isfree=0;

    $.ajax({
        url:caopan_url,
        type:'post',
        dataType:'json',
        data:{
            productId:productId,
            getlever:getlever,
            withfundingMoney:withfundingMoney,
            money1:money1,
            money2:money2,
            money3:money3,
            money4:money4,
            money5:money5,
            isTomorrowGetMoney:isTomorrowGetMoney,
            cycle:cycle,
            isfree:isfree
        },
        success:function (data) {
        	if(data.type==2){
        		// 登陆弹出
        		var cjnr_light = document.getElementById('cjnr_light');
				//cjnr_light.style.width = document.getElementsByTagName("nav").width;
				cjnr_light.style.display='block';
				document.getElementById('cjnr_fade').style.display='block';
				return false;
        	}
            layer.msg(data.msg, {icon: data.type, time:2000},function(){
            	window.location.reload();
            });
        }
    });

}


/*天天策略提交申请按钮*/
function ttcl_fade_wh(){
	var minMoney = 10000;
    var maxMoney = 5000000;
	if(!$('#ttcl_checkbox_id').is(':checked')) {
        layer.msg("请先阅读并同意签署", {icon: 6});
        return;
    }

    var a = Math.round($("#celuezhijin_zhi_tt").val());
    if(a<minMoney || a>maxMoney){
        layer.msg("请输入投资资本，最少1万，最多500万", {icon: 6});
        return;
    }
    if(a%1000>0){
        layer.msg("实盘资金必须是1000的整数倍!", {icon: 6});
        return;
    }


    var withfundingMoney=$("#celuezhijin_zhi_tt").val();  // 输入的投资本金
    var money1 = $("#ttcl_baozj").text(); // 风险保障金
    var money2 = $("#ttcl_allmoney").text(); // 总操盘资金
    var money3 = $("#ttcl_warningLine").text(); // 亏损警戒线
    var money4 = $("#ttcl_openLine").text(); // 亏损平仓线
    var money5 = $("#ttcl_zhanglf").text(); // 账户管理费
    var isTomorrowGetMoney=0; // 开始交易时间,默认1
    var Tday=5;
    var productId=8;
    var isfree=0;
    // console.log(withfundingMoney);
    // console.log(money1);
    // console.log(money2);
    // console.log(money3);
    // console.log(money4);
    // console.log(money5);
    // console.log(isTomorrowGetMoney);
    // console.log(Tday);
    // console.log(productId);
    // console.log(isfree);

    $.ajax({
        url:caopan_url,
        type:'post',
        dataType:'json',
        data:{
            productId:productId,
            withfundingMoney:withfundingMoney,
            money1:money1,
            money2:money2,
            money3:money3,
            money4:money4,
            money5:money5,
            isTomorrowGetMoney:isTomorrowGetMoney,
            Tday:Tday,
            isfree:isfree,
        },
        success:function (data) {
        	if(data.type==2){
        		// 登陆弹出
        		var cjnr_light = document.getElementById('ttcl_light');
				//cjnr_light.style.width = document.getElementsByTagName("nav").width;
				cjnr_light.style.display='block';
				document.getElementById('ttcl_fade').style.display='block';
				return false;
        	}
            layer.msg(data.msg, {icon: data.type, time:2000},function(){
            	window.location.reload();
            });
        }
    });

}






function cjnr_white_content(){
	document.getElementById('cjnr_light').style.display='none';
	document.getElementById('cjnr_fade').style.display='none'
}


function ttcl_white_content(){
	document.getElementById('ttcl_light').style.display='none';
	document.getElementById('ttcl_fade').style.display='none'
}


/*倒计时验证码*/
var clock = '';
 var nums = 60;
 var btn;
 var yzmhq = document.getElementById("yzmhq");//注册页面button内span标签
 function sendCode(thisBtn)
 {


	 var registno = $('#tel').val();
	 var msgcode = $("#msgcode").val();
	 console.log(registno);
	 console.log(msgcode);
	 console.log(info);

	 $.ajax({
            type: "post",
            url:reg_url,
            data:{registno:registno,msgcode:msgcode,info:info},
            dataType: 'JSON',
            success: function(result){
                if(result.success==1){
                	layer.msg(result.msg, {icon: 6},function(){
						btn = thisBtn;
						btn.disabled = true; //将按钮置为不可点击
						btn.style.width = 7+"rem";
						yzmhq.innerHTML = nums+"秒后重新获取";
						clock = setInterval(doLoop, 1000); //一秒执行一次
					});

                }else{
                    layer.msg(result.msg, {icon: 5});
                }
            },

        });
 }
 function doLoop()
 {
	 nums--;
	 if(nums > 0){
	 	 yzmhq.innerHTML = +nums+"秒后重新获取";
	 }else{
		  clearInterval(clock); //清除js定时器
		  btn.disabled = false;
		  btn.style.width = "";
		  yzmhq.innerHTML = "获取验证码";
		  nums = 60; //重置时间
 	}
 }


/*内容底部版权始终在最下方*/
var body_height = document.body.offsetHeight;
var main = document.getElementById("neirong_last");
if(main){
	var main_height = main.clientHeight;
	var height_chazhi = body_height-main_height;
	if(height_chazhi>100){
		main.style.height = body_height+"px";
	}else if(0<height_chazhi<=100){
		var xxx = body_height+120-height_chazhi;
		main.style.height = xxx+"px";
		//main.style.height = main.clientHeight;
	}else{
		var xxx = body_height+100;
		main.style.height = xxx+"px";
	}
	//console.log(height_chazhi);
}else{}


/*我要提盈页面左右按钮切换页面*/
// var wyty_b1 = document.getElementsByClassName("wyty_section1_b1");
// var wyty_b2 = document.getElementsByClassName("wyty_section1_b2");
//var wyty_b3 = document.getElementsByClassName("wyty_section1_b3");
// var wyty_s2 = document.getElementsByClassName("wyty_section2");
// var wyty_s3 = document.getElementsByClassName("wyty_section3");
//var wyty_s4 = document.getElementsByClassName("wyty_section4");

// if(wyty_s2[0]){
	// wyty_b1[0].style.backgroundColor="#1578d8";
	// wyty_b2[0].style.backgroundColor="#d6d6d6";
	// //wyty_b3[0].style.backgroundColor="#d6d6d6";
	// wyty_s3[0].style.display="none";
	// //wyty_s4[0].style.display="none";
	// wyty_s2[0].style.display="block";
	// //if(wyty_s3){console.log(wyty_s3)};
	// wyty_b1[0].onclick=function(){
	// 	wyty_b1[0].style.backgroundColor="#1578d8";
	// 	wyty_b2[0].style.backgroundColor="#d6d6d6";
	// 	//wyty_b3[0].style.backgroundColor="#d6d6d6";
	// 	wyty_s3[0].style.display="none";
	// 	//wyty_s4[0].style.display="none";
	// 	wyty_s2[0].style.display="block";
	// };
	// wyty_b2[0].onclick=function(){
	// 	wyty_b2[0].style.backgroundColor="#1578d8";
	// 	wyty_b1[0].style.backgroundColor="#d6d6d6";
	// 	//wyty_b3[0].style.backgroundColor="#d6d6d6";
	// 	wyty_s2[0].style.display="none";
	// 	//wyty_s4[0].style.display="none";
	// 	wyty_s3[0].style.display="block";
	// };
	//wyty_b3[0].onclick=function(){
	//	wyty_b3[0].style.backgroundColor="#1578d8";
	//	wyty_b1[0].style.backgroundColor="#d6d6d6";
	//	wyty_b2[0].style.backgroundColor="#d6d6d6";
	//	wyty_s2[0].style.display="none";
	//	wyty_s3[0].style.display="none";
	//	wyty_s4[0].style.display="block";
	//};
// }else{}



/*chongzhi*/
var aaaa_b1 = document.getElementsByClassName("aaa1");
var aaaa_b2 = document.getElementsByClassName("aaa2");
var aaaa_b3 = document.getElementsByClassName("aaa3");
var aaaa_s2 = document.getElementsByClassName("bbb2");
var aaaa_s3 = document.getElementsByClassName("bbb3");
var aaaa_s4 = document.getElementsByClassName("bbb4");

if(aaaa_s2[0]){
	aaaa_b1[0].style.backgroundColor="#fff";
	aaaa_b2[0].style.backgroundColor="#fff";
	aaaa_b3[0].style.backgroundColor="#fff";
	aaaa_b1[0].style.borderBottom="3px solid #f67355";
	aaaa_b2[0].style.borderBottom="none";
	aaaa_b3[0].style.borderBottom="none";
	aaaa_s4[0].style.display="none";
	aaaa_s3[0].style.display="none";
	aaaa_s2[0].style.display="block";
	//console.log(1);
	//if(wyty_s3){console.log(wyty_s3)};
	wyty_b1[0].onclick=function(){
		aaaa_b1[0].style.backgroundColor="#fff";
		aaaa_b2[0].style.backgroundColor="#fff";
		aaaa_b3[0].style.backgroundColor="#fff";
		aaaa_b1[0].style.borderBottom="3px solid #f67355";
		aaaa_b2[0].style.borderBottom="none";
		aaaa_b3[0].style.borderBottom="none";
		aaaa_s3[0].style.display="none";
		aaaa_s4[0].style.display="none";
		aaaa_s2[0].style.display="block";
	};
	aaaa_b2[0].onclick=function(){
		aaaa_b1[0].style.backgroundColor="#fff";
		aaaa_b2[0].style.backgroundColor="#fff";
		aaaa_b3[0].style.backgroundColor="#fff";
		aaaa_b2[0].style.borderBottom="3px solid #f67355";
		aaaa_b1[0].style.borderBottom="none";
		aaaa_b3[0].style.borderBottom="none";
		aaaa_s2[0].style.display="none";
		aaaa_s4[0].style.display="none";
		aaaa_s3[0].style.display="block";
	};
	aaaa_b3[0].onclick=function(){
		aaaa_b1[0].style.backgroundColor="#fff";
		aaaa_b2[0].style.backgroundColor="#fff";
		aaaa_b3[0].style.backgroundColor="#fff";
		aaaa_b3[0].style.borderBottom="3px solid #f67355";
		aaaa_b1[0].style.borderBottom="none";
		aaaa_b2[0].style.borderBottom="none";
		aaaa_s2[0].style.display="none";
		aaaa_s3[0].style.display="none";
		aaaa_s4[0].style.display="block";
	};
}else{}




/*交易记录页切换*/

// var anqh2 = document.getElementById("anqh2");
//
// if(anqh2){
// 	var wyty_b1 = document.getElementsByClassName("wyty_section1_b1");
// 	var wyty_b2 = document.getElementsByClassName("wyty_section1_b2");
// 	var wyty_b3 = document.getElementsByClassName("wyty_section1_b3");
// 	var wyty_b4 = document.getElementsByClassName("wyty_section1_b4");
// 	var wyty_b5 = document.getElementsByClassName("wyty_section1_b5");
//
// 	var wyty_s2 = document.getElementsByClassName("wyty_section2");
// 	var wyty_s3 = document.getElementsByClassName("wyty_section3");
// 	var wyty_s4 = document.getElementsByClassName("wyty_section4");
// 	var wyty_s5 = document.getElementsByClassName("wyty_section5");
// 	var wyty_s6 = document.getElementsByClassName("wyty_section6");
//
// 	wyty_b1[0].style.backgroundColor="#fff";
// 	wyty_b2[0].style.backgroundColor="#fff";
// 	wyty_b3[0].style.backgroundColor="#fff";
// 	wyty_b4[0].style.backgroundColor="#fff";
// 	wyty_b1[0].style.borderBottom="3px solid #f67355";
// 	wyty_b2[0].style.borderBottom="none";
// 	wyty_b3[0].style.borderBottom="none";
// 	wyty_b4[0].style.borderBottom="none";
// 	wyty_b5[0].style.borderBottom="none";
//
// 	wyty_s3[0].style.display="none";
// 	wyty_s4[0].style.display="none";
// 	wyty_s5[0].style.display="none";
// 	wyty_s6[0].style.display="none";
// 	wyty_s2[0].style.display="block";
// 	//console.log(1);
// 	if(wyty_s3){console.log(wyty_s3)};
// 	wyty_b1[0].onclick=function(){
// 		wyty_b1[0].style.backgroundColor="#fff";
// 		wyty_b2[0].style.backgroundColor="#fff";
// 		wyty_b3[0].style.backgroundColor="#fff";
// 		wyty_b1[0].style.borderBottom="3px solid #f67355";
// 		wyty_b2[0].style.borderBottom="none";
// 		wyty_b3[0].style.borderBottom="none";
// 		wyty_b4[0].style.borderBottom="none";
// 		wyty_b5[0].style.borderBottom="none";
// 		wyty_s4[0].style.display="none";
// 		wyty_s3[0].style.display="none";
// 		wyty_s5[0].style.display="none";
// 		wyty_s6[0].style.display="none";
// 		wyty_s2[0].style.display="block";
// 	};
// 	wyty_b2[0].onclick=function(){
// 		wyty_b1[0].style.backgroundColor="#fff";
// 		wyty_b2[0].style.backgroundColor="#fff";
// 		wyty_b3[0].style.backgroundColor="#fff";
// 		wyty_b2[0].style.borderBottom="3px solid #f67355";
// 		wyty_b1[0].style.borderBottom="none";
// 		wyty_b3[0].style.borderBottom="none";
// 		wyty_b4[0].style.borderBottom="none";
// 		wyty_b5[0].style.borderBottom="none";
// 		wyty_s2[0].style.display="none";
// 		wyty_s4[0].style.display="none";
// 		wyty_s4[0].style.display="none";
// 		wyty_s5[0].style.display="none";
// 		wyty_s6[0].style.display="none";
// 		wyty_s3[0].style.display="block";
// 	};
// 	wyty_b3[0].onclick=function(){
// 		wyty_b1[0].style.backgroundColor="#fff";
// 		wyty_b2[0].style.backgroundColor="#fff";
// 		wyty_b3[0].style.backgroundColor="#fff";
// 		wyty_b3[0].style.borderBottom="3px solid #f67355";
// 		wyty_b1[0].style.borderBottom="none";
// 		wyty_b2[0].style.borderBottom="none";
// 		wyty_b4[0].style.borderBottom="none";
// 		wyty_b5[0].style.borderBottom="none";
// 		wyty_s2[0].style.display="none";
// 		wyty_s3[0].style.display="none";
// 		wyty_s5[0].style.display="none";
// 		wyty_s6[0].style.display="none";
// 		wyty_s4[0].style.display="block";
// 	};
//
//     wyty_b4[0].onclick=function(){
//         wyty_b1[0].style.backgroundColor="#fff";
//         wyty_b2[0].style.backgroundColor="#fff";
//         wyty_b3[0].style.backgroundColor="#fff";
//         wyty_b3[0].style.borderBottom="none";
//         wyty_b5[0].style.borderBottom="none";
//         wyty_b4[0].style.borderBottom="3px solid #f67355";
//         wyty_b1[0].style.borderBottom="none";
//         wyty_b2[0].style.borderBottom="none";
//         wyty_s2[0].style.display="none";
//         wyty_s3[0].style.display="none";
//         wyty_s4[0].style.display="none";
//         wyty_s6[0].style.display="none";
//         wyty_s5[0].style.display="block";
//     };
//     wyty_b5[0].onclick=function(){
//         wyty_b1[0].style.backgroundColor="#fff";
//         wyty_b2[0].style.backgroundColor="#fff";
//         wyty_b3[0].style.backgroundColor="#fff";
//         wyty_b3[0].style.borderBottom="none";
//         wyty_b4[0].style.borderBottom="none";
//         wyty_b5[0].style.borderBottom="3px solid #f67355";
//         wyty_b1[0].style.borderBottom="none";
//         wyty_b2[0].style.borderBottom="none";
//         wyty_s2[0].style.display="none";
//         wyty_s3[0].style.display="none";
//         wyty_s4[0].style.display="none";
//         wyty_s5[0].style.display="none";
//         wyty_s6[0].style.display="block";
//     };
// }





/*银行卡开户地址和支行*/
var bdyhk_a_c_span = document.getElementById("bdyhk_a_c_span");
if(bdyhk_a_c_span){
	bdyhk_a_c_span.onclick=function (){
	var picker = new mui.PopPicker({
	 	layer:3
	 });
	picker.setData(cityData3);
 	picker.show(function (selectItems) {
   		bdyhk_a_c_span.innerHTML="<span id='bdyhk_a_c_span'>"+selectItems[0].text+"　"+selectItems[1].text+"　"+selectItems[2].text+"</span>";
   		//console.log(selectItems[0].text+selectItems[1].text+selectItems[2].text);
  	})
}
var yhpd = document.getElementById("yhpd");
var yhpd_div = document.getElementsByClassName("tjyhk_huise");
yhpd_div1 = yhpd_div[0];
yhpd_div1.style.display = "none";
// yhpd.onblur = function(){
// 	var text = yhpd.value;
// 	text = text.replace(/\s/ig,'');
// 	var yinhang = bankCardAttribution(text);
// 	var yhlx = document.getElementById("yhlx");
// 	var yhtb = document.getElementById("yhtb");
// 	if(yinhang=="error"){
// 		yhtb.innerHTML = "<span class='iconfont icon-gantanhao' style='color:red;margin-left:3rem'></span>";
// 		yhlx.innerHTML = "<span id='yhlx' style='font-size: 0.8rem;'>"+"您填写的银行卡卡号有误"+"</span>";
// 	}else{
// 		yhtb.innerHTML = "<span class='iconfont icon-yinhangqia1'></span>";
// 		yhlx.innerHTML = "<span id='yhlx' style='font-size: 0.8rem;'>"+yinhang.bankName+"-"+yinhang.cardTypeName+"</span>";
// 	}
// 	yhpd_div1.style.display = "block";
// 	//console.log(yinhang.bankName+yinhang.cardTypeName);若没有，返回NaN，yinhang的返回值是error，有的时候yinhang返回json数组
//
// }


}

/*密码页的正则验证*/
var xgmm_p = document.getElementsByClassName("xgmm");
var xgmm_p_span = document.getElementById("xgmm_p_span");
function zhengzyz(str){
	var zzyz = str.match(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,18}$/);
	str_length = str.length;
	if(5<str_length && str_length<19 && zzyz){
		xgmm_p[0].style.display="none";
		console.log("匹配成功");
	}else{
		xgmm_p_span.innerHTML = "密码应为6-18位数字和字母组合";
		xgmm_p[0].style.display="block";
		return false;
	}

}
function zhengzyz2(str2){
	var zhengzyz_id = document.getElementById("zhengzyz_id");
	if(str2==zhengzyz_id.value){
		xgmm_p_span.innerHTML = "密码应为6-18位数字和字母组合";
		zhengzyz(str2);
	}else{
		xgmm_p_span.innerHTML = "您输入的密码不一致";
		xgmm_p[0].style.display="block";
		return false;
	}
}



/*策略资金选择器*/
var celuezijin_zhi = mui("#celuezijin_zhi")[0];
var cjnr_allmoney = mui("#cjnr_allmoney")[0];
var cjnr_warningLine = mui("#cjnr_warningLine")[0];
var cjnr_openLine = mui("#cjnr_openLine")[0];
var cjnr2_c2_id1 = mui("#cjnr2_c2_id1")[0];
var cjnr2_c2_id2 = mui("#cjnr2_c2_id2")[0];
var cjnr2_c2_id3 = mui("#cjnr2_c2_id3")[0];
var cjnr2_c2_id4 = mui("#cjnr2_c2_id4")[0];
var cjnr2_c2_id5 = mui("#cjnr2_c2_id5")[0];
var cjnr_baozj = mui("#cjnr_baozj")[0];
var cjnr_zhanglf = mui("#cjnr_zhanglf")[0];
var cjnr_Amoney = mui("#cjnr_Amoney")[0];
var cjnr_zhanglfxi = mui("#cjnr_zhanglfxi")[0];
var cjnr_zhanglfmh = mui("#cjnr_zhanglfmh")[0];
var cjnr_zhanglfmh_al = mui("#cjnr_zhanglfmh_al")[0];
var celuezijin_xuan2 = document.getElementsByName("cjnr2_checkbox2");
var cjnr_xi;



mui(".celuezijin_xuan").on('change', 'input', function() {
	if (this.checked) {

		switch (this.value) {
			case "10000":
				celuezijin_zhi.value = 10000;
				www();
				break;
			case "50000":
				celuezijin_zhi.value = 50000;
				www();
				break;
			case "100000":
				celuezijin_zhi.value = 100000;
				www();
				break;
			case "200000":
				celuezijin_zhi.value = 200000;
				www();
				break;
			case "500000":
				celuezijin_zhi.value = 500000;
				www();
				break;
			case "1000000":
				celuezijin_zhi.value = 1000000;
				www();
				break;
			case "2000000":
				celuezijin_zhi.value = 2000000;
				www();
				break;
			default:
				console.log("意外错误1");
				break;
		}
	}
});
mui(".celuezijin_xuan2").on('change','input',function(){
	if (this.checked) {
		www();
	}else{
		console.log("未选择放大倍数");
	}
});


//获取输入框值的函数和后续
function www(){
	//输入框失去焦点，获取输入框的值，以备下面内容修改
	var cjnr_zhi = parseInt(celuezijin_zhi.value);
    if(cjnr_zhi > 5000000){
        cjnr_zhi = 5000000;
    }
	//策略资金手动输入验证事件
		if(celuezijin_zhi.value%10!=0){
			mui(".cjnr2_section1_li1_div span")[0].style.backgroundColor="red";
			mui(".cjnr2_section1_li1_div .triangle")[0].style.borderRightColor = "red";
			//console.log(celuezijin_zhi.value%10000);
			return;
		}else{
			mui(".cjnr2_section1_li1_div span")[0].style.backgroundColor="#fbaf51";
			mui(".cjnr2_section1_li1_div .triangle")[0].style.borderRightColor = "#fbaf51";
		}

	//输入框失去焦点，修改放大倍数的值
	for(i=1;i<=5;i++){
        var or = /^\+?[1-9][0-9]*$/;　　//正整数
        if(or.test(cjnr_zhi*i/10000)){
            mui("#cjnr2_c2_id"+i)[0].innerText = (cjnr_zhi*i/10000);
        }else{
            mui("#cjnr2_c2_id"+i)[0].innerText = (cjnr_zhi*i/10000).toFixed(1);
        }
	}
	uuu(cjnr_zhi);

};
//整体数值更换函数
function uuu(cjnr_zhi){
	//获取输入框的值或快速选择的值
	cjnr_zhi = cjnr_zhi;
	//获取倍数和倍数对应的值
	for(ii=0;ii<5;ii++){
		if(celuezijin_xuan2[ii].checked){
			var celuezijin_x2 = celuezijin_xuan2[ii].value;
		}
	}
	var cjnr_xuan2 = cjnr_zhi*parseInt(celuezijin_x2);
	//修改总操盘金额（等于输入框金额与放大倍数金额的和）
	cjnr_allmoney.innerText = Math.floor(cjnr_zhi+cjnr_xuan2);
	//修改亏损警戒线
	cjnr_warningLine.innerText = Math.ceil(cjnr_xuan2*1.15);
	//修改平仓线
	cjnr_openLine.innerText = Math.floor(cjnr_xuan2*1.1);
	//修改账户保证金（等于输入框金额）
	cjnr_baozj.innerText = Math.floor(cjnr_zhi);
	//调用账户管理费函数，计算月息
	var glf = cjnr_mouth_xi(cjnr_xuan2,celuezijin_x2);
    //修改最后一栏的账户管理费，金额同总利息
    cjnr_zhanglf.innerText = glf;
    //修改共计支付金额（等于保证金与管理费的和）
    cjnr_Amoney.innerText = parseInt(cjnr_zhanglf.innerText)+parseInt(cjnr_baozj.innerText);

}
//账户管理费函数
function cjnr_mouth_xi(cjnr_allmoney,cjnr_bei){

	var cjnr_select = mui('.cjnr_select1')[0].selectedIndex+1;
	var p_allmoney = parseInt(cjnr_allmoney);
	if(cjnr_bei==1){
		cjnr_xi = 120;
	}else if(cjnr_bei==2){
		cjnr_xi = 130;
	}else{
		if(p_allmoney>=1000000){
            if(cjnr_select>=3){
                cjnr_xi = 180;
            }else if(cjnr_select>=1){
                cjnr_xi = 190;
            }
        }else if(p_allmoney>=100000){
            if(cjnr_select>=3){
                cjnr_xi = 190;
            }else if(cjnr_select>=1){
                cjnr_xi = 200;
            }
        }else if(p_allmoney>=1000){
            if(cjnr_select>=3){
                cjnr_xi = 200;
            }else if(cjnr_select>=1){
                cjnr_xi =210;
            }
        }
        cjnr_xi = cjnr_xi-(6-cjnr_bei)*10;

	}
	//调用函数后，单月利息利率
	cjnr_zhanglfxi.innerText = cjnr_xi/100;
	//调用函数后，单月利息
	cjnr_zhanglfmh.innerText = Math.floor(p_allmoney*cjnr_xi/10000);
	//调用函数后，选择月份后总利息
	cjnr_zhanglfmh_al.innerText = Math.floor(parseInt(cjnr_zhanglfmh.innerText)*cjnr_select);

    return  Math.floor(p_allmoney*cjnr_xi/10000*cjnr_select);

}


/*策略资金快速选择与手动输入切换*/
var cjnr_kuaixuan = mui(".cjnr_kuaixuan")[0];
var cjnr_shuru = mui(".cjnr_shuru")[0];
var cjnr_shou = mui(".cjnr_shou")[0];
var cjnr_xuan = mui(".cjnr_xuan")[0];

mui(".mui-table-view-cell").on('tap','.cjnr_shuru',function(){

	cjnr_xuan.style.display="none";
	cjnr_shou.style.display="block";
});
mui(".mui-table-view-cell").on('tap','.cjnr_kuaixuan',function(){

	cjnr_xuan.style.display="block";
	cjnr_shou.style.display="none";
});








/*策略资金选择器 ttttttttttttttt*/celuezhijin_zhi_tt
var celuezhijin_zhi_tt = mui("#celuezhijin_zhi_tt")[0];
var ttcl_allmoney = mui("#ttcl_allmoney")[0];
var ttcl_warningLine = mui("#ttcl_warningLine")[0];
var ttcl_openLine = mui("#ttcl_openLine")[0];
var ttcl2_c2_id1 = mui("#ttcl2_c2_id1")[0];
var ttcl2_c2_id2 = mui("#ttcl2_c2_id2")[0];
var ttcl2_c2_id3 = mui("#ttcl2_c2_id3")[0];
var ttcl2_c2_id4 = mui("#ttcl2_c2_id4")[0];
var ttcl2_c2_id5 = mui("#ttcl2_c2_id5")[0];
var ttcl_baozj = mui("#ttcl_baozj")[0];
var ttcl_zhanglf = mui("#ttcl_zhanglf")[0];
var ttcl_Amoney = mui("#ttcl_Amoney")[0];
var ttcl_zhanglfxi = mui("#ttcl_zhanglfxi")[0];
var ttcl_zhanglfmh = mui("#ttcl_zhanglfmh")[0];
var ttcl_zhanglfmh_al = mui("#ttcl_zhanglfmh_al")[0];
var celuezijin_xuan2_tt = document.getElementsByName("ttcl2_checkbox2");
var ttcl_xi;



mui(".celuezijin_xuan_tt").on('change', 'input', function() {
	if (this.checked) {
		switch (this.value) {
			case "10000":
				celuezhijin_zhi_tt.value = 10000;
				www2();
				break;
			case "30000":
				celuezhijin_zhi_tt.value = 30000;
				www2();
				break;
			case "80000":
				celuezhijin_zhi_tt.value = 80000;
				www2();
				break;
			case "100000":
				celuezhijin_zhi_tt.value = 100000;
				www2();
				break;
			case "200000":
				celuezhijin_zhi_tt.value = 200000;
				www2();
				break;
			case "300000":
				celuezhijin_zhi_tt.value = 300000;
				www2();
				break;
			case "500000":
				celuezhijin_zhi_tt.value = 500000;
				www2();
				break;
			default:
				console.log("意外错误");
				break;
		}
	}
});
mui(".celuezijin_xuan2_tt").on('change','input',function(){
	if (this.checked) {
		www2();
	}else{
		console.log("未选择放大倍数");
	}
});


//获取输入框值的函数和后续
function www2(){
	//输入框失去焦点，获取输入框的值，以备下面内容修改
	var ttcl_zhi = parseInt(celuezhijin_zhi_tt.value);
    if(ttcl_zhi > 2000000){
        ttcl_zhi = 2000000;
    }
	//策略资金手动输入验证事件
		if(celuezhijin_zhi_tt.value%10!=0){
			mui(".ttcl2_section1_li1_div span")[0].style.backgroundColor="red";
			mui(".ttcl2_section1_li1_div .triangle")[0].style.borderRightColor = "red";
			//console.log(celuezhijin_zhi_tt.value%10000);
			return;
		}else{
			mui(".ttcl2_section1_li1_div span")[0].style.backgroundColor="#fbaf51";
			mui(".ttcl2_section1_li1_div .triangle")[0].style.borderRightColor = "#fbaf51";
		}

	//输入框失去焦点，修改放大倍数的值
	for(i=3;i<=5;i++){
		mui("#ttcl2_c2_id"+i)[0].innerText = Math.floor(ttcl_zhi/i);
	}

	uuu2(ttcl_zhi);

};
//整体数值更换函数
function uuu2(ttcl_zhi){
	//获取输入框的值或快速选择的值
	ttcl_zhi = ttcl_zhi;

	//获取倍数和倍数对应的值
	for(ii=0;ii<3;ii++){
		if(celuezijin_xuan2_tt[ii].checked){
			var celuezijin_x2 = celuezijin_xuan2_tt[ii].value;
		}
	}

	var ttcl_xuan2 = ttcl_zhi;
	//修改总操盘金额（等于输入框金额与放大倍数金额的和）
	ttcl_allmoney.innerText = Math.floor(ttcl_zhi+(ttcl_xuan2/celuezijin_x2));
	//修改亏损警戒线
	ttcl_warningLine.innerText = Math.ceil(ttcl_xuan2*1.15);
	//修改平仓线
	ttcl_openLine.innerText = Math.floor(ttcl_xuan2*1.1);
	//修改账户保证金（等于输入框金额）
	ttcl_baozj.innerText = Math.floor(ttcl_xuan2/celuezijin_x2);
	//调用账户管理费函数，计算月息
    //修改最后一栏的账户管理费，金额同总利息
	var glf2 = ttcl_mouth_xi(ttcl_xuan2,celuezijin_x2);
    ttcl_zhanglf.innerText = glf2;

    //修改共计支付金额（等于保证金与管理费的和）
    ttcl_Amoney.innerText = parseInt(ttcl_zhanglf.innerText)+parseInt(ttcl_baozj.innerText);

}
//账户管理费函数
function ttcl_mouth_xi(ttcl_allmoney,ttcl_bei){

	var p_allmoney = parseInt(ttcl_allmoney);
	if(ttcl_bei==4){
		ttcl_xi = p_allmoney*0.15/100;
	}else if(ttcl_bei==5){
		ttcl_xi = p_allmoney*0.18/100;
	}
	else if(ttcl_bei==3){
		ttcl_xi = p_allmoney*0.15/100;
	}

	//调用函数后，单月利息利率
	ttcl_zhanglfxi.innerText = ttcl_xi;

	return Math.round(ttcl_xi);

}


/*策略资金快速选择与手动输入切换*/
var ttcl_kuaixuan = mui(".ttcl_kuaixuan")[0];
var ttcl_shuru = mui(".ttcl_shuru")[0];
var ttcl_shou = mui(".ttcl_shou")[0];
var ttcl_xuan = mui(".ttcl_xuan")[0];

mui(".mui-table-view-cell").on('tap','.ttcl_shuru',function(){

	ttcl_xuan.style.display="none";
	ttcl_shou.style.display="block";
});
mui(".mui-table-view-cell").on('tap','.ttcl_kuaixuan',function(){

	ttcl_xuan.style.display="block";
	ttcl_shou.style.display="none";
});
